xen/sched: fix race in RTDS scheduler
authorJuergen Gross <jgross@suse.com>
Fri, 21 Oct 2022 10:32:23 +0000 (12:32 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 21 Oct 2022 10:32:23 +0000 (12:32 +0200)
commit73c62927f64ecb48f27d06176befdf76b879f340
tree55cdf020312cb5218f5eba05d464b34a293fae37
parentf324300c8347b6aa6f9c0b18e0a90bbf44011a9a
xen/sched: fix race in RTDS scheduler

When a domain gets paused the unit runnable state can change to "not
runnable" without the scheduling lock being involved. This means that
a specific scheduler isn't involved in this change of runnable state.

In the RTDS scheduler this can result in an inconsistency in case a
unit is losing its "runnable" capability while the RTDS scheduler's
scheduling function is active. RTDS will remove the unit from the run
queue, but doesn't do so for the replenish queue, leading to hitting
an ASSERT() in replq_insert() later when the domain is unpaused again.

Fix that by removing the unit from the replenish queue as well in this
case.

Fixes: 7c7b407e7772 ("xen/sched: introduce unit_runnable_state()")
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Dario Faggioli <dfaggioli@suse.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
xen/common/sched/rt.c